//
//  SNBaseCell.m
//  DayDayHappy
//
//  Created by yutao on 14-2-21.
//  Copyright (c) 2014年 yutao. All rights reserved.
//

#import "SNBaseCell.h"


@implementation SNBaseCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //内容
        txtContent = [[UILabel alloc]init];
        [txtContent setBackgroundColor:[UIColor whiteColor]];
        [txtContent setFont:[UIFont systemFontOfSize:17]];
        [txtContent setTextColor:[UIColor colorWithRed:83/255.0 green:83/255.0 blue:83/255.0 alpha:1.0]];
        [txtContent setNumberOfLines:0];
        [txtContent setLineBreakMode:NSLineBreakByWordWrapping];
        [self addSubview:txtContent];
        
        //图片
        contentImageView = [[UIImageView alloc] init];
        contentImageView.layer.cornerRadius = 4;
        contentImageView.userInteractionEnabled = YES;
        contentImageView.layer.masksToBounds = YES;
        [self addSubview:contentImageView];
        
        [self setSelectionStyle:UITableViewCellSelectionStyleNone];
    }
    return self;
}

- (void)setUpImageCellWithObject:(SNBaseModel*)imageModel atIndexPath:(NSIndexPath*)indexPath
{
    CGSize textSize = [imageModel.content sizeWithFont:[UIFont systemFontOfSize:17] constrainedToSize:CGSizeMake(kCellContentWidth, HUGE_VAL) lineBreakMode:NSLineBreakByWordWrapping];
    [txtContent setText:imageModel.content];
    [txtContent setFrame:CGRectMake(10, 15, kCellContentWidth, ceilf(textSize.height))];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
